package com.heima.article.service.Impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.article.mapper.ArticleMapper;
import com.heima.article.service.ArticleService;
import com.heima.model.article.dtos.ArticleHomeDto;
import com.heima.model.article.pojos.ApArticle;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, ApArticle> implements ArticleService {


    // 用户端主页展示
    @Override
    public ResponseResult load(ArticleHomeDto dto) {
        //Page<ApArticle> page = page(new Page<ApArticle>(1, 5));
        //return ResponseResult.okResult(page.getRecords());

        List<ApArticle> articleList = baseMapper.load(dto);
        return ResponseResult.okResult(articleList);
    }
}
